//
//  TRMyRequest.m
//  TLBS
//
//  Created by tarena on 14-3-29.
//  Copyright (c) 2014年 tarena. All rights reserved.
//

#import "TRMyRequest.h"
#import "TRAppDelegate.h"
@implementation TRMyRequest

void (^myCallback)(NSString *);

-(void)requestWithParams:(NSMutableDictionary *)params apiName:(NSString *)apiName httpMethod:(NSString *)method :(void (^)(NSString* jsonString))callback{
    
    TRAppDelegate *app = [UIApplication sharedApplication].delegate;
   
    [app.weiboApi requestWithParams:params apiName:apiName httpMethod:method delegate:self];
 
    self.lodingAV = [[UIAlertView alloc]initWithTitle:@"" message:@"正在加载。。。" delegate:Nil cancelButtonTitle:Nil otherButtonTitles:Nil, nil];
    
    [self.lodingAV show];
    
    myCallback = callback;
    
}

- (void)didReceiveRawData:(NSData *)data reqNo:(int)reqno{
    NSString *strResult = [[NSString alloc] initWithBytes:[data bytes] length:[data length] encoding:NSUTF8StringEncoding];
    [self.lodingAV dismissWithClickedButtonIndex:0 animated:YES];
    myCallback(strResult);
}


@end
